//
//  FavViewModel.m
//  ForYourBeauty
//
//  Created by Kelly xu on 2019/6/3.
//  Copyright © 2019 changrenTech. All rights reserved.
//

#import "FavViewModel.h"

@implementation FavViewModel
-(void)fetchFavListWithCmp:(void(^)(NSMutableArray *favList))cmp{
    [[HttpClient shareClient]postWithUrl:FAVLIST params:@{
        @"blurSearch": @{},
        @"order": @{},
        @"p": @(0),
        @"search": @{},
        @"size": @(10)
    } suc:^(id results) {
        NSArray *list = [results objectForKey:@"resultList"];
        NSMutableArray *favlist = [[NSMutableArray alloc]init];
        for (NSDictionary *item in list) {
            [favlist addObject:[FinderDetailModel modelObjectWithDictionary:item]];
        }
        cmp(favlist);
    } fail:^(NSString *error, NSInteger status) {
        Toast(error);
    }];
}
@end
